#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e5 + 5;

int n, m;
int head[N];
int ver[N << 1], Next[N << 1], tot;
void add(int u, int v) {
  ++tot;
  ver[tot] = v;
  Next[tot] = head[u];
  head[u] = tot;
}
int dep[N], fa[N][18];
int dfn[N], cnt;
void dfs(int u, int fu) {
  dfn[u] = ++cnt;
  dep[u] = dep[fu] + 1;
  fa[u][0] = fu;
  rep(i, 1, 16) fa[u][i] = fa[fa[u][i - 1]][i - 1];
  for (int i = head[u]; i; i = Next[i]) {
    int v = ver[i];
    if (v == fu) continue;
    dfs(v, u);
  }
}
int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  int d = dep[u] - dep[v];
  per(i, 16, 0) if (d & (1 << i)) u = fa[u][i];
  if (u == v) return u;
  per(i, 16, 0) if (fa[u][i] != fa[v][i]) u = fa[u][i], v = fa[v][i];
  return fa[u][0];
}
int k, a[N], sz[N], st[N], top, ans;
bool check() {
  rep(i, 1, k) if (sz[fa[a[i]][0]]) return false;
  return true;
}
bool cmp(int u, int v) { return dfn[u] < dfn[v]; }
void build() {
  sort(a + 1, a + k + 1, cmp);
  st[top = 1] = 1;
  if (a[1] != 1) st[++top] = a[1];
  rep(i, 2, k) {
    int x = lca(st[top], a[i]);
    while (top > 1 && dep[st[top - 1]] >= dep[x])
      add(st[top - 1], st[top]), top--;
    if (x != st[top]) add(x, st[top]), st[top] = x;
    st[++top] = a[i];
  }
  while (top > 1) add(st[top - 1], st[top]), top--;
}
void dp(int u) {
  if (sz[u]) {
    for (int i = head[u]; i; i = Next[i]) {
      int v = ver[i];
      dp(v);
      if (sz[v]) ans++, sz[v] = 0;
    }
  } else {
    for (int i = head[u]; i; i = Next[i]) {
      int v = ver[i];
      dp(v);
      sz[u] += sz[v], sz[v] = 0;
    }
    if (sz[u] > 1) ans++, sz[u] = 0;
  }
  head[u] = 0;
}
void solve() {
  tot = 0;
  cin >> k;
  rep(i, 1, k) cin >> a[i];
  rep(i, 1, k) sz[a[i]] = 1;
  if (!check()) {
    cout << -1 << endl;
    rep(i, 1, k) sz[a[i]] = 0;  // clear
    return;
  }
  ans = 0;
  build();    // init head, sz
  dp(1);      // clear head, sz (except root 1)
  sz[1] = 0;  // clear
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 2, n) {
    int u, v;
    cin >> u >> v;
    add(u, v), add(v, u);
  }
  dfs(1, 0);
  memset(head, 0, sizeof(head));
  int q;
  cin >> q;
  while (q--) solve();
  return 0;
}